define(function(require,exports,module){
	require("resource/js/easyui/themes/icon.css");
	require("resource/js/easyui/easyloader.js");
	require.async("resource/js/component/rules.js");
	var A = require("resource/js/component/ajax.js");
	var easyutil = require("resource/js/component/easyutil.js");
	var treeutil = require("resource/js/component/treeutil.js");
	var easycombobox = require("resource/js/component/easycombobox.js");

	function initPage(){
		
		var sectionId = sessionStorage.getItem('sectionId');
		if(sectionId == null || sectionId == undefined){
			sectionId = '001';
		}
		
		A.init().sync().success(function(code,msg,data){
			$('#deviceSet_form').form('load',data);
		}).post(BASEPATH + '/dcs/sys/deviceSet/queryDeviceSetBySectionId.htm', {sectionId:sectionId});
		
		$('.save_button').unbind('click').bind('click',function(){
			
			using("form",function(){
				if($("#deviceSet_form").form("validate")){
					
					var obj = $("#deviceSet_form").serializeJson();
					
					/**
					 * 处理标段Id
					 */
					obj.sectionId = sectionId;
					
					A.init().success(function(code,msg,data){
						$.messager.alert('系统提示',msg,'',function(){
							window.location.href=BASEPATH+"/view/dcs/sys/deviceSet/deviceSet";
						});
					}).post(BASEPATH + '/dcs/sys/deviceSet/saveDeviceSet.htm',obj);
					
				}
			});
		});

	}

	exports.trans = function(){

		using(["datagrid","parser","textbox","numberbox","dialog","combobox","datetimebox","validatebox","messager"],function(){
			initPage();
		});
	}
});


